<%@page import="util.enviaEmail"%>
<%
Connection conn = null;
try {
	conn = new Conexao().getConexao();
} catch (Exception e) {
	new enviaEmail().enviar(e);
	out.print("falhaConexao");
	return;
}
%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="conexao.Conexao"%>
<%@page import="java.sql.Connection"%>
<%@page import="dao.OSDao"%>
<%@page import="bean.OSBean"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="css/blue/style.css" />
</head>
<body>
	<legend class="ui-corner-all"
		style="margin-left: 10px;">Entrega</legend>
		<table class="tablesorter ui-corner-top">
			<thead>
				<tr>
					<th align="center" width="25" class="ui-corner-tl">Cód.</th>
					<th>Cliente</th>
					<th align="center" width="85">Entrada</th>
					<th align="center" width="35">Ações</th>
					<th width="6" class="ui-corner-tr"></th>
				</tr>
			</thead>
		</table>
		<div class="divScroll">
		<table id="tabelaEntregar" class="tablesorter">
			<tbody>
				<%
					OSBean os = new OSBean();
					os.setIdEmpresa((Integer) session.getAttribute("idempresa"));
					List<OSBean> osEntregar = new OSDao().getListaSituacaoOS(conn,
							"entregar", os);
					if (!osEntregar.isEmpty()) {
						for (int i = 0; i < osEntregar.size(); i++) {
							SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy HH:mm");
							String data = df.format(osEntregar.get(i).getDataEntrega());
				%>
				<tr
				<%if(osEntregar.get(i).getUrgente() == 1){%>
				style="color: red;"
				<%}%>
				>
					<td width="27"><%=osEntregar.get(i).getId()%></td>
					<td><%=osEntregar.get(i).getNomeCliente()%></td>
					<td width="87" align="center"><%=data%></td>
					<td align="center" width="37"><img src="imagens/magnifier-zoom.png" title="Descrição e Comentário" style="cursor: pointer;"
						onclick="abreDescricao('<%=osEntregar.get(i).getId()%>')">
					<img src="imagens/imprimir.png" title="Imprimir" style="cursor: pointer;" onclick="imprimirOS('<%=osEntregar.get(i).getId()%>')">
					</td>
				</tr>
				<%
					}
					} else {
				%>
				<tr>
					<td colspan="4">Nenhuma OS p/ entregar</td>
				</tr>
				<%
					}
					conn.close();
				%>
			</tbody>
		</table>
		</div>
</body>
</html>